//
//  RequestManager.m
//  JewelryStore
//
//  Created by apple on 2017/1/4.
//  Copyright © 2017年 com. All rights reserved.
//

#import "RequestManager.h"

static RequestManager *gSharedRequestManager = nil;

@implementation RequestManager

+ (instancetype)sharedRequestManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        gSharedRequestManager = [[[self class] alloc] init];
    });
    
    return gSharedRequestManager;
}

- (void)requestTestData
{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];

    [manager GET:@"http://192.168.1.110:804/wxj/ApiData.aspx?Access_token=1&&Pid=1" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        NSError *error = nil;

        if (responseObject) {
            
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:&error];
            
            NSLog(@"%@", dict);

        }else
        {
            NSLog(@"%@", error);
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)
    {
        NSLog(@"%@", error);
    }];
}
@end
